<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="csrf-token" content="{{ csrf_token() }}" />

<title>LX-用户列表</title>
<link href="/style/authority/basic_layout.css" rel="stylesheet" type="text/css">
<link href="/style/authority/common_style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="external nofollow" rel="external nofollow" >
</head>
<body>
    <div class="layui-body">
    <!-- 内容主体区域 -->
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>权限名单</legend>

    </fieldset>
    <button onclick="add()">添加</button>

    <div class="layui-form">
        <table class="layui-table">
            <colgroup>
                <col width="50">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="200">
                <col width="100">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
            	<th>ID</th>
                <th>名字</th>
                <th>密码</th>
                <th>所属组</th>
                <th>邮箱</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
                @foreach($result as $val)       
		           <tr>
		            <td>{{$val->id}}</td>
		            <td>{{$val->gm_name}}</td>
		            <td>{{$val->gm_pwd}}</td>
		            <td>{{$val->group}}</td>
		            <td>{{$val->gm_email}}</td>
		            <td><font size="4" color="orange">{{$val->status==1?"运行中":"待机中"}}</font></td>
		            <td>
		            	<input type="hidden" id="_token" name="_token" value="{{ csrf_token() }}">
				        <button onclick="dostatus({{$val->status}},{{$val->id}})">{{$val->status==1?"禁用":"启用"}}</button>
				        <button onclick="del({{$val->id}})">删除</button>
				        <button onclick="dostatus({{$val->status}},{{$val->id}})">编辑</button>
		            </td>

		          </tr>
         		@endforeach
            </tbody>

        </table>
    </div>
  <center>
 	{{ $result->render()}}
  </center>



	<!--底部区域-->
	<div id="container">
		<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center"  border="0">
		    <tr>
		      <th colspan="2">系统版本</th>
		    </tr>
		    <tr>
		      <td width="100" height="30">当前版本<span class="TableRow2"></span></td>
		      <td style="text-align:left">后台管理系统 4.1</td>
		    </tr>
		</table>
		<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
		    <tr>
		      <th colspan="2">系统开发 </th>
		    </tr>
		    <tr>
		      <td width="100" height="30">程序制作</td>
		      <td style="text-align:left">信息科技有限公司</td>
		    </tr>
		    <tr>
		      <td width="100" height="30">联系方式</td>
		      <td style="text-align:left">
		      	<a href="mailto:sitename@126.com">1398367100@qq.com</a>
		      </td>
		    </tr>
		</table>
	</div>

</body>
<script type="text/javascript" src="/scripts/jquery/jquery-1.7.1.js"></script>
<script>
function dostatus(status,id)
{	
	var _token = $('#_token').val();
	var data = new FormData();
	data.append('_token',_token);
	data.append('status',status);
	data.append('id',id);
	//alert(status);
	 $.ajax({
    type:"post",
    url:"{{url('/index/intro_do')}}",
    data:data,
    cache: false,
    processData: false,
    contentType: false,
	    success:function(msg){
	      if(msg == 1){
	      	window.location.href = 'http://www.cucurbit.com/index/introduce';
	      }else{
	      	window.location.href = 'http://www.cucurbit.com/index/introduce';
	      }
	    },
	});
}


	function del(id)
	{	
		var _token = $('#_token').val();
		var data = new FormData();
		data.append('_token',_token);
		data.append('id',id);
	   // alert(id);
	    $.ajax({
	    	type:"post",
	    	url:"{{url('/index/del_do')}}",
	    	data:data,
	    	cache: false,
		    processData: false,
		    contentType: false,
	    	success:function(msg){
		      if(msg == 1){
		      	alert('删除成功！');
		      	window.location.href = 'http://www.cucurbit.com/index/introduce';
		      }else{
		      	alert('删除失败！');
		      	window.location.href = 'http://www.cucurbit.com/index/introduce';
		      }
		    },
	    });

	}

function add()
{
	location.href="http://www.cucurbit.com/index/add";
}
</script>
</html>
